<template>
  <div class="new-record">
    <div class="top-record">
      <div class="title">新碟上架</div>
      <div class="record-more">更多</div>
    </div>

    <!-- <div class="record-list">
      <div class="swiper-container">
        <div class="swiper-wrapper">
          <div class="swiper-slide" v-for="item in recordList" :key="item.id">
            <img :src="item.picUrl" alt />
            <div class="name">{{item.name}}</div>
            <div class="singer">{{item.artists[0].name}}</div>
          </div>
        </div>
      </div>
    </div>-->
    <Carousel v-model="value1" class="carousel">
      <Carousel-item v-for="item in recordList" :key="item.id" class="carousel-item">
        <div class="demo-carousel">
          <img :src="item.picUrl" alt />
          <div class="name">{{item.name}}</div>
          <div class="singer">{{item.artists[0].name}}</div>
        </div>
      </Carousel-item>
    </Carousel>
  </div>
</template>
<script>
import { getRecord } from "@/api/index.js";

export default {
  data() {
    return {
      recordList: [],
      value1: 0
    };
  },
  async mounted() {
    let res = await getRecord("10");
    this.recordList = res.data.weekData;
    console.log(res);
  }
};
</script>
<style scoped lang="less">
.new-record {
  width: 7.5rem;
  height: 4rem;
  margin-bottom: 1rem;
  .top-record {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem;
    margin: 0 0.2rem;
    border-bottom: 2px solid red;
    .title {
      font-size: 0.35rem;
      font-weight: 900;
    }
    .record-more {
      font-size: 0.24rem;
    }
  }

  .carousel::-webkit-scrollbar {
    width: 0 !important;
  }
  .carousel {
    width: 7.1rem;
    height: 2.8rem;
    display: flex;
    margin: 0.2rem auto;
    overflow: scroll;
    .carousel-item {
      margin-right: 0.2rem;
      .demo-carousel {
        display: flex;
        flex-direction: column;
        img {
          width: 1.5rem;
          height: 1.5rem;
        }
        .name {
          font-size: 0.28rem;
          width: 1.5rem;
          text-align: center;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }
        .singer {
          font-size: 0.24rem;
          width: 1.5rem;
          text-align: center;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }
      }
    }
  }
}
</style>